package com.xs.web;

import com.xs.pojo.Log;
import com.xs.service.LogSercice;
import com.xs.service.impl.LogSerciceImpl;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.List;

@WebServlet("/selectServlet")
public class SelectServlet extends HttpServlet {
    LogSercice logSercice=new LogSerciceImpl();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Log> logs = logSercice.SelectAll();
        //将数据存到request域中
        request.setAttribute("logs",logs);
        request.getRequestDispatcher("/booklog.jsp").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
